package com.samehope.ar.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.samehope.ar.entity.TaskNormal;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.samehope.ar.vo.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 正式巡检任务 Mapper 接口
 * </p>
 *
 * @author Zhang Luo
 * @since 2019-12-23
 */
public interface TaskNormalMapper extends BaseMapper<TaskNormal> {

    List<TaskNormalDataVO> findByParam(@Param("companyId") Long companyId
            , @Param("projectId")Long projectId
            , @Param("planId")Long planId
            , @Param("teamId")Long teamId
            , @Param("userId")Long userId
            , @Param("taskTime")String taskTime
            , @Param("taskName")String taskName
            , @Param("taskType")String taskType
            , @Param("taskStatus")String taskStatus);

    List<TaskTimeVO> findTaskTime(Page<TaskTimeVO> page
            , @Param("companyId")Long companyId
            , @Param("projectId")Long projectId
            , @Param("planId")Long planId
            , @Param("teamId")Long teamId
            , @Param("userId")Long userId
            , @Param("startDate")String startDate
            , @Param("endDate")String endDate
            , @Param("taskName")String taskName
            , @Param("taskType")String taskType
            , @Param("taskStatus")String taskStatus);

    void insertByPlans(PatrolTaskPlanWeekDetailVO vo);

    /**
     * 根据用户查找单独执行的正式任务
     * @param projectId
     * @param userId
     * @return
     */
    List<TaskNormal> findTaskNormalNotOverByProjectAndUser(@Param("projectId") Long projectId,
                                                    @Param("userId") Long userId);

    void delByTaskTime(@Param("taskTime") String taskTime);

    void delByUnFinishTask(@Param("planId") Long planId, @Param("updateBy") Long updateBy);

    TaskNormalDetailVO findByTaskId(@Param("companyId") Long companyId, @Param("projectId")Long projectId, @Param("taskId")Long taskId);

    List<FormSelectVO> getTaskName(@Param("companyId") Long companyId, @Param("projectId")Long projectId);
}
